<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/context/mytags.jsp"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>行业关键词查询</title>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery/jquery.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery/jquery-ui/jquery-ui.js"></script>

<script src="${pageContext.request.contextPath}/js/bootstrap/bootstrap.js" type="text/javascript"></script>
<script src="${pageContext.request.contextPath}/ui/table/bootstrap-table.js" type="text/javascript"></script>
<script src="${pageContext.request.contextPath}/ui/table/locale/bootstrap-table-zh-CN.js" type="text/javascript"></script>
<script src="${pageContext.request.contextPath}/ui/table/plugins/tableExport.js" type="text/javascript"></script>
<script src="${pageContext.request.contextPath}/ui/table/plugins/table-export.js" type="text/javascript"></script>
<script src="${pageContext.request.contextPath}/ui/table/plugins/jquery.base64.js" type="text/javascript"></script>

<script src="${pageContext.request.contextPath}/ui/layui/layui.js" type="text/javascript"></script>
<script src="${pageContext.request.contextPath}/ui/layui/lay/modules/laydate.js" type="text/javascript"></script>
<script src="${pageContext.request.contextPath}/ui/layui/lay/modules/layer.js" type="text/javascript"></script>
 <script src="${pageContext.request.contextPath}/ui/layui/lay/modules/form.js" type="text/javascript"></script>
 <link rel="stylesheet" href="${pageContext.request.contextPath}/ui/layui/css/modules/laydate/laydate.css" >
 <link rel="stylesheet" href="${pageContext.request.contextPath}/css/jquery-css/jquery-ui.css">
 <link rel="stylesheet" href="${pageContext.request.contextPath}/css/bootstrap-css/bootstrap.css">
<link rel="stylesheet" href="${pageContext.request.contextPath}/ui/table/bootstrap-table.css">
<link rel="stylesheet" href="${pageContext.request.contextPath}/ui/layui/css/layui.css" >
<link rel="stylesheet" href="${pageContext.request.contextPath}/ui/layui/css/global.css" >
<link rel="stylesheet" href="${pageContext.request.contextPath}/ui/layui/css/modules/layer/default/layer.css" >
 <link rel="stylesheet" href="${pageContext.request.contextPath}/ui/layui/css/modules/code.css" >


 <style>
  .container{
   	width:85%;
   	
  }
  
  .modal-industry{
  	width:700px;
  }
  .modal-body{
    max-height:750px
  }
   .modal-body-industry{
  	height:450px;
  }
    
 </style>

</head>
<body>
<%@include file="/webpage/frame/top.jsp" %>
<div class="container">
	<div id="topContent" class="layui-form-pane">
		<div class="layui-form-item" style="margin-bottom:0px;">
		 <div class="layui-inline">
		      <label class="layui-form-label">按行业查询</label>
		      <div class="layui-input-inline">
		        <select id="industrySel" lay-verify="" lay-search style="margin-left:3px;">
		          <option value="">选择全部行业</option>
		        </select>
		      </div>
		    </div>		
		
		</div>
	</div>		
	
	<table id="companytable"  data-show-refresh="true"
              data-search="true"
              data-click-to-select="true"
              data-show-export="true"
              data-query-params="queryParams"
              data-pagination="true"
		   	  data-toolbar=".toolbar"		   
              >
             <!-- data-show-columns="true" -->          
           <thead>
           <tr>
           	<th data-field="id" data-show="true" data-visible="false">id</th>
            <th data-field="industry">所属行业</th>
            <th data-field="companyName">公司名称</th>
            <th data-field="companyStateValue">续费状态</th>
            <th data-field="registerTime">注册时间</th>
            <th data-field="username">负责客服</th>
            <th data-field="isHasAccount">是否已添加账户</th>
            <th data-field="action"
                data-align="center"
                data-formatter="actionFormatter"
                data-events="actionEvents">操作</th>
           </tr>
           </thead>
		
	</table>

</div>

<script>
	var API_URL = '${pageContext.request.contextPath}/industryKeywordController.do?getCompanyByIndustryPage';	
	//加载公司列表
	var $table = $('#companytable').bootstrapTable(
			{
				url: API_URL,
				pageSize:25,
				pageList : [15, 25, 100, 500],
				//queryParams:{industryId:$('#industrySel').val()}
			}   		  
			 ),     
	   $modal = $('#modal').modal({show: false}),
	   $alert = $('.alert').hide(),
	   $alert_input = $('.alert_input').hide();
	
    function actionFormatter(value,row, index) {        
    	buttonArray =  new Array();
    	//console.log(row.isHasBaiduData);
    	if(row.isHasBaiduData!='0'){
    		buttonArray[0]='<a class="lookbaidu btn btn-default" href="javascript:" title="查看百度推广数据">查看百度数据</a>';
    	}
    	
        return buttonArray.join(' ');
    }
    
    window.actionEvents = {
    		//查看百度数据
        	'click .lookbaidu': function (e, value, row) {
    			$(location).attr('href','${pageContext.request.contextPath}/promoteDataController.do?showBaidu_manager&companyId='+row.id);
    		}
    }
    
   //延迟加载 
   $(function() {
	   //加载全部行业
	   loadIndustry();
	   
   }); 
    
   //加载全部行业
   function loadIndustry() {
		$.get("${pageContext.request.contextPath}/industryController.do?getAllIndustry",
				function(result){
			      var data = $.parseJSON(result);			     
			       for(i=0;i<data.length;i++){				    	  
			    	  //$("#industrySel").append("<option value='"+data[i]["id"]+"'>"+data[i]["industry"]+"</option>");
			    	  $("#industrySel").append("<option value='"+data[i]["industry"]+"'>"+data[i]["industry"]+"</option>");
			       }				    	
				}					
		);   
   } 
   
    //按行业搜索
	$("#industrySel").click(
		function(){
			//刷新服务器数据
			//var query = {industryId:$('#industrySel').val()};
			//$('#companytable').bootstrapTable('refresh', {query:query});

			//设置页面搜索内容 //$('#industrySel').find("option:selected").text()
			$('#companytable').bootstrapTable('resetSearch', $('#industrySel').val());
		}
	);
   
    
</script>
<%@include file="/webpage/frame/bottom.jsp" %>
</body>
</html>